<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
   <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!doctype html>
<html lang="en">
<head>
	<c:set var="ctxPath" value="${pageContext.request.contextPath}"
		scope="application" />
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>我的二维码</title>
    <link rel="stylesheet" href="${ctxPath }/static/customer/css/reg.css">
    <script src="${ctxPath }/static/customer/js/jquery-1.8.3.min.js"></script>
    <script src="${ctxPath }/static/customer/layer/mobile/layer.js"></script>
</head>
<body>
    <div class="container">
        <div class="codeBox">
            <div class="btnBox" >
            	<c:if test="${vertification !='0' && vertification !='3' && not empty vertification  && vertification !=''}">
            		<a href="javascript:;" class="active"  id="btn_customer">顾客</a>
            	</c:if>
                <c:choose>
                	<c:when test="${vertification=='1' }">
                		<a href="javascript:;" id="btn_delar" >经销商</a>
                	</c:when>
                	<c:when test="${vertification=='2' }">
                			<a href="javascript:;" id="btn_dashi" >推广大使</a>
                	</c:when>
                </c:choose>
            </div>
            <div class="codeImgBox">
                <div class="imgBox1">
                    <img src="" alt=""   id="QRCodeImg">
                </div>
            </div>
        </div>
    </div>
    <script>
    	$(function(){
    		var vertification='${vertification}';
    		vertification !='0' ? getQRCode("btn_customer")  :  getQRCode("customer");
    	})
        $(".btnBox a").click(function(){
            $(this).addClass("active").siblings().removeClass("active");
            getQRCode($(this).attr("id"));
        })
        function getQRCode(id){
        	if(! id){
        		return;
        	}
        	$(".codeImgBox div").hide().eq($(".btnBox a").index(this)).show();
        	var customerId="${customerId}";
        	var vertification="${vertification}";
        	if("btn_customer"==id){
        		//顾客 0
        		$("#QRCodeImg").attr("src","${ctxPath }/customer/getQRCode?headImg=&identity=0&customerId="+customerId);
        	}else if("btn_delar"==id){
        		//经销商 2
        		$("#QRCodeImg").attr("src","${ctxPath }/customer/getQRCode?headImg=&identity=2&customerId="+customerId);
        	}else if("btn_dashi"==id){
        		//推广大使 3
        		$("#QRCodeImg").attr("src","${ctxPath }/customer/getQRCode?headImg=&identity=3&customerId="+customerId);
        	}else{
        		$("#QRCodeImg").attr("src","${ctxPath }/customer/getQRCode?headImg=&identity=4&customerId="+customerId);
        	}
        }
    </script>
</body>
</html>